<template>
  <AddCommerce
    :show-uploader="false"
    :show-navbar="false"
    @confirm="handleSave"
    @cancel="handleCancel"
  ></AddCommerce>
</template>

<script>
import AddCommerce from "../components/commerce.vue";
import { fetchBusinessOpportunity } from "@/services";
import { Toast } from "vant";
export default {
  components: {
    AddCommerce,
  },
  methods: {
    async handleSave(form, done) {
      try {
        await fetchBusinessOpportunity(form);
        done();
        Toast("新增成功");
        this.$router.back();
      } catch (error) {
        console.log(error.message);
        done();
        Toast(error.message || "新增失败");
      }
    },
    handleCancel() {
      this.$router.back();
    },
  },
};
</script>

<style lang="scss" scoped></style>
